﻿using Newtonsoft.Json;
using PW.Api;
using PW.Api.Model;
using RestSharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PW.Api.Api
{
    public class LoginApi
    {
        public static async Task<ResponseContent> login(LoginModel data)
        {
            ResponseContent res = await Request.postAsync("/login", data);
            if (res != null && res.code == 200) {
                Request.token = res.token;
                Request.restclient.AddDefaultHeader("Authorization", "Bearer " + res.token);
            }
            return res;
        }
    }
}
